public class Hanoi {
    public static void Hanoi(int n,char A,char B,char C){
        //初始汉诺塔层数，起始柱子A，中途柱子B，最终柱子C
        if(n == 1){
            move(A , C);
            return;
        }
        Hanoi(n - 1, A , C , B );
        move(A , C);
        Hanoi(n - 1, B , A , C );

    }
    public static void move(char A,char C){
        System.out.println(A+"->"+C);
    }

    public static void main(String[] args) {
        int n = 3;
        Hanoi( n , 'A' , 'B' , 'C');
    }
}
